<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>轮岗管理</title>
    <jsp:include page="/WEB-INF/views/common/link.jsp"/>

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@include file="/WEB-INF/views/common/navbar.jsp" %>
    <!--菜单回显-->
    <c:set var="currentMenu" value="work"/>
    <%@include file="/WEB-INF/views/common/menu.jsp" %>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>轮岗管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/work/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <div class="form-group">
                        <label for="name">姓名:</label>
                        <input type="text" class="form-control" id="name" name="name" value="${qo.name}"
                               placeholder="请输入姓名">
                    </div>
                    <div class="form-group">
                        <label for="unit">单位:</label>
                        <input type="text" class="form-control" id="unit" name="unit" value="${qo.unit}"
                                placeholder="请输入单位">

                    </div>
                    <button id="btn_query" class="btn btn-default">查询</button>
                
                <a href="/work/input" class="btn btn-success btn-input" style="margin: 10px">
                    <span class="glyphicon glyphicon-plus"></span> 添加
                </a>
                <a href="/work/export" class="btn btn-warning">
                    <span class="glyphicon glyphicon-download"></span> 导出
                </a>
                <a href="#" class="btn btn-warning btn-import">
                    <span class="glyphicon glyphicon-upload"></span> 导入
                </a>
                    <script>
                        $(".btn-import").click(function () {
                            $("#importModal").modal('show');

                        })
                    </script>


               </form>

                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered" align="center">
                        <tr>
                            <th>编号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>电话号码</th>
                            <th>所属单位</th>
                            <th>所属职务</th>
                            <th>上轮轮岗日期</th>
                            <th>本轮轮岗日期</th>
                            <th>剩余天数</th>
                            <th>操作</th>
                        </tr>
<%--                        items 遍历数据的目标   EL    var d
                             for(Work dept : list){
                                  dept
                             }--%>
                        <c:forEach items="${pageInfo.list}" var="d" varStatus="vs">
                            <tr>
                                <td>${vs.count}</td>
                                <td>${d.name}</td>
                                <td>${d.sex?'男':'女'}</td>
                                <td>${d.age}</td>
                                <td>${d.phone_number}</td>
                                <td>${d.unit}</td>
                                <td>${d.job.name}</td>
                                <td>${d.last_date}</td>
                                <td>${d.now_date}</td>
                                <td class="my_red">${d.remain}</td>
                                <td>
                                    <a class="btn btn-info btn-xs btn-input" href="/work/input?id=${d.id}">
                                        <span class="glyphicon glyphicon-pencil"></span> 修改
                                    </a>
                                    <a href="javaScript:void(0);" data-url="/work/delete?id=${d.id}" class="btn btn-danger btn-xs btn-delete">
                                        <span class="glyphicon glyphicon-trash"></span> 删除
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                    <!--分页-->
                    <%@include file="/WEB-INF/views/common/page.jsp" %>
                </div>
            </div>
        </section>
    </div>
    <%@include file="/WEB-INF/views/common/footer.jsp" %>
</div>




<script>

    $(function(){
        var da = $(".my_red");
        da.each(function (index) {
            console.log($(this).text());
            if($(this).text()<=30){
                $(this).css("color","red")
            }
        })
    });
</script>
<div class="modal fade" id="importModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">导入</h4>
            </div>
            <form class="form-horizontal" action="/work/importXls" enctype="multipart/form-data" method="post" id="importForm">
                <div class="modal-body">
                    <div class="form-group" style="margin-top: 10px;">
                        <label  class="col-sm-3 control-label"></label>
                        <div class="col-sm-6">
                            <!-- 文件上传框 -->
                            <input type="file" name="multipartFile"/>
                        </div>
                    </div>
                    <div class="form-group" style="margin-top: 10px;">
                        <div class="col-sm-3"></div>
                        <div class="col-sm-6">
                            <a href="/upload/work_upload.xls" class="btn btn-success" >
                                <span class="glyphicon glyphicon-download"></span> 下载模板
                            </a>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary btn-submit">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
